<title>列表</title>
<!-- /section:settings.box -->
<div class="row list_classify">
	<div class="col-xs-12">
		<div class="tabbable tabbable2">
			<ul class="nav nav-tabs padding-12 tab-color-blue background-blue">
				<li name="li_tab" class="active" data-identity="-1"><a
					href="javascript:;">全部</a></li>
			</ul>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div>
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>ID</th>
								<th>分类名称</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="data" style="display: table-row-group;">
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<table class="list-tpl hidden">
			<tr>
				<td>id</td>
				<td>name</td>
				<td>
					<button type="button" class="btn btn-mini btn-info child"
						title="数据字典">数据字典</button>
					<button type="button" class="btn btn-mini btn-info addchild"
						title="添加数据字典">添加数据字典</button>
				</td>
			</tr>
		</table>
		<!-- TemplteHidden -->
		<script type="text/javascript">
		var scripts = [null,null];
		$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
			var $scope=$('.list_classify');	
			$('.data',$scope).empty();
			$.getJSON('/sys/ajax_dict_type_list',function(ret)
				{
						if(ret.status>0)
						{
							var $data=$('.data',$scope);
							$data.hide();
							$data.empty();
							var data=ret.data;							
							for(var i in data)
							{
								var v=data[i];
								var id=v['id'];
								var $item=$('.list-tpl tr',$scope).clone();
								$('td:eq(0)',$item).attr('data-identity','id-'+id).text(id);
								$('td:eq(1)',$item).attr('data-identity','name_label-'+id).text(v['sys_value']);
								$('td:eq(2) .child',$item).attr('data-identity','child-'+id);
								$('td:eq(2) .addchild',$item).attr('data-identity','addchild-'+id);								
								$data.append($item);
							}
							$data.show();
						}
						else {
							message_box.show(ret.data,'error');
						}
					});					
			$scope.delegate('[data-identity^="child-"]','click',function(){
				var id=$(this).attr('data-identity').split('-')[1];
				var	url='/sys/dict_list?dt_pk='+id;
				gDialog.fCreate({title:'数据字典列表',url:url,width:800}).show();
			}).delegate('[data-identity^="addchild-"]','click',function(){
				var id=$(this).attr('data-identity').split('-')[1];
				var	url='/sys/dict_editor?dt_pk='+id;
				gDialog.fCreate({title:'添加数据字典',url:url,width:600}).show();
			})		
		});		
		</script>
	</div>
</div>
